#include <stdio.h>
#include <stdlib.h>
#include "Complex.h"

void test01() {
	Complex c1;
	Create(c1, 2, 3);
	printf("2+3i复数的实部为：%f\n",GetReal(c1));
	printf("2+3i复数的虚部为：%f\n",GetImag(c1));
	
	Create(c1, 0, 0);
	printf("0+0i复数:");
	PrintComplex(c1);
	Create(c1, 0, 1);
	printf("0+1i复数:");
	PrintComplex(c1);
	Create(c1, 1, 0);
	printf("1+0i复数:");
	PrintComplex(c1);
	Create(c1, 1, -1);
	printf("1-1i复数:");
	PrintComplex(c1);
	Create(c1, 0, -1);
	printf("0-1i复数:");
	PrintComplex(c1);
}

void test02() {
	Complex c1, c2, c3;

	Create(c1, 0, 0);
	printf("复数c1：");
	PrintComplex(c1);

	Create(c2, 0, 0);
	printf("复数c2：");
	PrintComplex(c2);

	printf("复数c1+c2：");
	c3 = Add(c1, c2);
	PrintComplex(c3);

	//Operation: Sub
	printf("复数c1-c2：");
	c3 = Sub(c1, c2);
	PrintComplex(c3);

	//Operation: Mul
	printf("复数c1*c2：");
	c3 = Mul(c1, c2);
	PrintComplex(c3);

	//Operation: Div
	printf("复数c1/c2：");
	c3 = Div(c1, c2);
	PrintComplex(c3);
}

void test03() {
	Complex c1, c2, c3;

	Create(c1, 4, 6);
	printf("复数c1：");
	PrintComplex(c1);

	Create(c2, 6, 4);
	printf("复数c2：");
	PrintComplex(c2);

	printf("复数c1+c2：");
	c3 = Add(c1, c2);
	PrintComplex(c3);

	//Operation: Sub
	printf("复数c1-c2：");
	c3 = Sub(c1, c2);
	PrintComplex(c3);

	//Operation: Mul
	printf("复数c1*c2：");
	c3 = Mul(c1, c2);
	PrintComplex(c3);

	//Operation: Div
	printf("复数c1/c2：");
	c3 = Div(c1, c2);
	PrintComplex(c3);
}


int main(int argc, char *argv[]) {
	test01();
	test03();
	test02();

	return 0;
}
